from tkinter import *
root= Tk()
def callback():
    print("helloworld")

menubar = Menu(root)  #创建一个顶级菜单
menubar.add_command(label = "你好",command = callback)
menubar.add_command(label = "退出",command = root.quit)

#显示菜单
root.config(menu = menubar)

mainloop()
